package game;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;


public class KeyClass implements KeyListener {
	private Gameplayer g;
	
	public KeyClass(Gameplayer g){
		this.g = g;
	}

		public void keyPressed(KeyEvent ke) {
			if (ke.getKeyCode() == KeyEvent.VK_UP || ke.getKeyCode() == KeyEvent.VK_W) {
				g.PlayerMoved("up");
			} else if(ke.getKeyCode() == KeyEvent.VK_DOWN || ke.getKeyCode() == KeyEvent.VK_S) {
				g.PlayerMoved("down");
			} else if(ke.getKeyCode() == KeyEvent.VK_LEFT || ke.getKeyCode() == KeyEvent.VK_A) {
				g.PlayerMoved("left");
			} else if(ke.getKeyCode() == KeyEvent.VK_RIGHT || ke.getKeyCode() == KeyEvent.VK_D) {
				g.PlayerMoved("right");
			} else if(ke.getKeyCode() == KeyEvent.VK_SPACE) {
				g.playerShot();
			}
	}

	public void keyReleased(KeyEvent ke) {
		//unused
	}

	public void keyTyped(KeyEvent arg0) {
		//unused
	}
}